package repository

import entity.Role
import org.hibernate.criterion.Restrictions

class RoleRepositoryImpl : RoleRepository {
    override fun findByName(type: Role.RoleType): Role {
        return executeTransaction {
            val criteria = it.createCriteria(Role::class.java)
            criteria.add(Restrictions.eq("name", type.toString()))
            criteria.uniqueResult() as Role
        }
    }
}